package com.ln.dm1031.demo03;

/**
 * @author Ln
 * @version 终极版
 * @date 2022/10/31 15:08
 */
public class MyTicket implements Runnable{
    private int ticket=100;
    @Override
    public void run() {

           while (true){
                if (ticket > 0){
                System.out.println(Thread.currentThread().getName() + "卖了一张票，剩余:" + --ticket);
            }else {
                    System.out.println("票已售空，请明天再来！！");
                    break;
            }
        }

    }
}
